﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AnimalFight.Lib;
using AnimalFight.Lib.Data;

namespace AnimalFight.Main
{
    public class Program
    {
        public static void Main(string[] args)
        {
            BattleField battleField = new BattleField();

            Dog dog1 = new Dog
            {
                Name = "Doggy",
                HP = 1000,
                DP = 100,
                AP = 300,
                Mood = DogMood.Good
            };

            Dog dog2 = new Dog
            {
                Name = "Snoopy",
                HP = 1000,
                DP = 150,
                AP = 250,
                Mood = DogMood.Bad
            };

            Duck duck1 = new Duck
            {
                Name = "Donald",
                HP = 1000,
                DP = 200,
                AP = 500
            };

            Snake snake1 = new Snake
            {
                Name = "Anaconda",
                HP = 1000,
                DP = 50,
                AP = 300
            };

            Horse horse1 = new Horse
            {
                Name = "Horse",
                HP = 1000,
                DP = 200,
                AP = 200
            };

            battleField[dog1.Name] = dog1;
            battleField[dog2.Name] = dog2;
            battleField[snake1.Name] = snake1;
            battleField[duck1.Name] = duck1;
            battleField[horse1.Name] = horse1;

            //battleField.Command("Doggy", Commands.Attack, "Anaconda");

            string commandLine;
            string command = string.Empty;

            while (command != "Exit")
            {
                commandLine = System.Console.ReadLine();
                string[] commands = commandLine.Split(' ');
                command = commands[0];
                switch (command)
                {
                    case "Attack":
                        if (commands.Length < 3)
                        {
                            Console.WriteLine("Invalid Commands for attack.");
                        }
                        else
                        {
                            battleField.Command(commands[1], Commands.Attack, commands[2]);
                        }
                        break;
                    case "Defend":
                        if (commands.Length < 2)
                        {
                            Console.WriteLine("Invalid Commands for defend.");
                        }
                        else
                        {
                            battleField.Command(commands[1], Commands.Defend, string.Empty);
                        }
                        break;
                    case "Escape":
                        if (commands.Length < 2)
                        {
                            Console.WriteLine("Invalid Commands for escape.");
                        }
                        else
                        {
                            battleField.Command(commands[1], Commands.Escape, string.Empty);
                        }
                        break;
                    case "Exit":
                        Console.WriteLine("Exit application.");
                        break;
                    default:
                        Console.WriteLine("Invalid Commands.");
                        break;
                }
            }
        }
    }
}
